One or more aspects of the present invention relate to a database, as well as to tables in the database, and more specifically, to managing a sharing relationship of the tables.
With the development of information technology and the Internet, resource sharing becomes a trend. For instance, in the field of databases, a plurality of users may share a same database so as to realize the maximum possible resource sharing with a deployment of high-density and to save hardware and software costs. Each user does not own the shared database exclusively, so such a user is usually called a “tenant” which is indicative of a logic entity that uses the database service. On the other hand, in the mean time of sharing, it needs to isolate data of respective tenants from each other considering safety needs and to satisfy individual requirements of respective tenants. Therefore, as for a database that supports multiple tenants, a balance is needed between sharing and isolating.
More specifically, isolating of data usually means that different tenants use tables of different schemas to store the respective data. However, sharing of data means that to some extent, a plurality of tenants need to keep some consistency on the schema so as to share the tables at least partially. There are some prior art of dealing with the requirement of schema diversity using a PIVOT table, a private table, Pre-allocated fields, custom columns, chunk folding and some schema mapping techniques to realize sharing of data. However, the solutions for dealing with the requirement of schema diversity still has some drawbacks, like sparse data, extra expensive join effort, extra predicates and hard usage of index on customized columns. Some solutions are logically shared schema with physically isolated tables. Some solutions are native support of a physically shared table, but they need extra operations and cost like data dictionary lookup, table descriptor mapping, data type mapping, field pointer linking, etc. for realizing sharing.